<?php
declare (strict_types=1);

namespace app\controller;

use app\facade\Param;
use app\helpers\api\ApiResponse;
use app\model\Information;
use app\model\Signup;
use app\model\User;
use app\model\Vegetables;
use think\facade\Db;
use think\Request;

class InformationController
{
    use ApiResponse;

    /**
     * 消息列表
     * @return \think\Response
     */
    public function index(Request $request)
    {
        $query = Information::field('user_id,to_user_id,content,time')->order('time', 'asc');
        $query = Param::informationParam($request->param(), $query);
        return $this->success($query->select());
    }

    //发送消息
    public function store(Request $request)
    {
        Information::create($request->param());
        return $this->created();
    }


}
